package com.lz.repository.lg.impl;

import java.io.Serializable;
import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.beans.factory.parsing.QualifierEntry;
import org.springframework.stereotype.Repository;

import com.lz.entity.Car;
import com.lz.entity.Customer;
import com.lz.entity.OrderSheet;
import com.lz.repository.lg.OrderSheetDao;
import com.lz.repository.lg.VO.OrderSheetVO;
@Repository
public class OrderSheetDaoImpl implements OrderSheetDao {

	@Override
	public Integer addCar(Session session, Car car) {
		Integer save = (Integer)session.save(car);
		return save;
	}

	@Override
	public Integer addCustomer(Session session, Customer customer) {
		Integer save = (Integer)session.save(customer);
		return save;
	}

	@Override
	public Integer addorderSheet(Session session, OrderSheet orderSheet) {
		Integer save = (Integer)session.save(orderSheet);
		return save;
	}

	@Override
	public OrderSheet findOrderSheet(Session session,String hql) {
		Query query = session.createQuery(hql);
		OrderSheet orderSheet = (OrderSheet)query.uniqueResult();
		return orderSheet;
	}

	@Override
	public List<OrderSheet> selectOrders(Query query) {
		return query.list();
	}

	@Override
	public Integer rowsOfOrderSheet(Query query) {
		return query.list().size();
	}
}
